/**
 * <copyright>
 * </copyright>
 *
 */
package org.soaism.soadsl.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.soaism.soadsl.Message;
import org.soaism.soadsl.RemoteService;
import org.soaism.soadsl.RemotingAspect;
import org.soaism.soadsl.SoadslPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Remoting Aspect</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.soaism.soadsl.impl.RemotingAspectImpl#getMessages <em>Messages</em>}</li>
 *   <li>{@link org.soaism.soadsl.impl.RemotingAspectImpl#getRemoteServices <em>Remote Services</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RemotingAspectImpl extends ModelAspectImpl implements RemotingAspect
{
  /**
   * The cached value of the '{@link #getMessages() <em>Messages</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMessages()
   * @generated
   * @ordered
   */
  protected EList<Message> messages;

  /**
   * The cached value of the '{@link #getRemoteServices() <em>Remote Services</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getRemoteServices()
   * @generated
   * @ordered
   */
  protected EList<RemoteService> remoteServices;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected RemotingAspectImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return SoadslPackage.Literals.REMOTING_ASPECT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Message> getMessages()
  {
    if (messages == null)
    {
      messages = new EObjectContainmentEList<Message>(Message.class, this, SoadslPackage.REMOTING_ASPECT__MESSAGES);
    }
    return messages;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<RemoteService> getRemoteServices()
  {
    if (remoteServices == null)
    {
      remoteServices = new EObjectContainmentEList<RemoteService>(RemoteService.class, this, SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES);
    }
    return remoteServices;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case SoadslPackage.REMOTING_ASPECT__MESSAGES:
        return ((InternalEList<?>)getMessages()).basicRemove(otherEnd, msgs);
      case SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES:
        return ((InternalEList<?>)getRemoteServices()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case SoadslPackage.REMOTING_ASPECT__MESSAGES:
        return getMessages();
      case SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES:
        return getRemoteServices();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case SoadslPackage.REMOTING_ASPECT__MESSAGES:
        getMessages().clear();
        getMessages().addAll((Collection<? extends Message>)newValue);
        return;
      case SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES:
        getRemoteServices().clear();
        getRemoteServices().addAll((Collection<? extends RemoteService>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case SoadslPackage.REMOTING_ASPECT__MESSAGES:
        getMessages().clear();
        return;
      case SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES:
        getRemoteServices().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case SoadslPackage.REMOTING_ASPECT__MESSAGES:
        return messages != null && !messages.isEmpty();
      case SoadslPackage.REMOTING_ASPECT__REMOTE_SERVICES:
        return remoteServices != null && !remoteServices.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //RemotingAspectImpl
